package il.ac.biu.cs.grossmm.api.server;

/**
 * Provides API to be used by server services (objects that implement
 * <tt>Service</tt> interface). Each server service is associated with its
 * own service manager.
 * 
 * @see Service
 */
public interface ServiceManager {
	
	/**
	 * Called when associated service needs another service to be activated
	 * @param serviceHint the hint of the required service
	 * @throws Exception
	 */
	void requireService(Object serviceHint) throws Exception;
	
	/**
	 * Called when associated service does not longer need a previously activated
	 * service to be running. Note that the specified service is terminated only
	 * when it is not required by any other service.
	 * @param serviceHint
	 */
	void releaseService(Object serviceHint);
	
	/**
	 * Called when a service has stopped due to an error and could not
	 * restart immideately. The <tt>exception</tt> may provide further 
	 * information.  
	 *  
	 * @param exception
	 */
	void terminated(Exception exception);
}
